fix(workers): make hardcoded run-workers overall timeout configurable#5545
Open
gololdf1sh wants to merge 2 commits intocodeceptjs:4.xfrom
Open
fix(workers): make hardcoded run-workers overall timeout configurable#5545gololdf1sh wants to merge 2 commits intocodeceptjs:4.xfrom
gololdf1sh wants to merge 2 commits intocodeceptjs:4.xfrom
Conversation
The `run-workers` command has had a hardcoded 10-minute overall timeout since codeceptjs#5370 ("fix workers crash"). When the timeout fires, ALL still-running workers are force-terminated and only results from naturally-finished workers make it into the aggregated summary. For suites whose total wall-clock with N workers is in the same ballpark as 10 minutes, this guarantees a portion of tests will be silently dropped from the report — even on a healthy run. There is currently no CLI flag, env var, or config option to override. Make the timeout configurable, with `600000` ms (10 min) preserved as default for backward compatibility: 1. `CODECEPT_WORKERS_TIMEOUT` env var (ms) — highest precedence 2. `workersTimeout` field in codecept.conf (ms) 3. Default `600000` Setting the value to `0` (or any non-positive number) disables the timeout entirely. Adds 6 unit tests covering resolution order, env-over-config precedence, disabled mode, and non-numeric fallback.
DavertMik
requested changes
Apr 30, 2026
Contributor
DavertMik
left a comment
There was a problem hiding this comment.
Move default timeout to const
| if (Number.isFinite(envTimeout)) return envTimeout | ||
| const configTimeout = this.codecept?.config?.workersTimeout | ||
| if (Number.isFinite(configTimeout)) return configTimeout | ||
| return 600000 |
Contributor
There was a problem hiding this comment.
600 000 = 10x60x100
Add const
const WORKER_TIMEOUT_MINUTES =10
Suggested change
| return 600000 | |
| return WORKER_TIMEOUT_MINUTES*60*1000 |
Address review feedback on codeceptjs#5545: replace the magic literal `600000` in `_getWorkersTimeoutMs()` with a module-level `WORKER_TIMEOUT_MINUTES` constant and an explicit `* 60 * 1000` conversion, so the default value reads as "10 minutes" at the call site. No behavior change — default still resolves to 600000 ms.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
run-workershas a hardcoded 10-min overall timeout (added in #5370). When it fires, all still-running workers are force-terminated and their results never reach the aggregated summary — silently dropped. No CLI/env/config override exists.Hit this on a 4-worker run of a ~50-min sequential suite: only 28% of tests reported, with
[Main] Overall timeout reached (10 minutes)at t=10m07s.Fix
Make the timeout configurable. Default
600000ms preserved (backward-compat). Resolution order:CODECEPT_WORKERS_TIMEOUTenv var (ms)workersTimeoutin codecept.conf (ms)6000000disables the timeout entirely. Log message minutes value is now dynamic.Changes
lib/workers.js: extract_getWorkersTimeoutMs(), gatesetTimeoutbehind> 0checktypings/index.d.ts: addworkersTimeout?: numbertoMainConfigtest/unit/worker_test.js: 6 unit tests (default / env / config / precedence / disabled / non-numeric fallback) — all passType of change